<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<form action="parkinglist.do" name="search" method="get" onsubmit="return searchCheck()">
	<table width="200" align="center" border="0" cellspacing="0" cellpadding="2">
		<tr>
			<td align="center">	
				<select name="keyField">
					<option value="p_name">주차장이름</option>
					<option value="p_phone">핸드폰번호</option>
					<option value="all">전체</option>
				</select>
			</td>
			<td>
				<input type="text" size="16" name="keyWord">
			</td>
			<td>
				<input type="submit" value="찾기">
			</td>
		</tr>
	</table>
</form>
<table width="80%" border="1" cellspacing="0" cellpadding="2" align="center">
	<tr>
		<c:if test="${userLevel == 3 || userLevel == 1}">
		<td align="right" colspan="8">
			<input type="button" value="주차장등록" onclick="location.href='write.do?m_id=${m_id}'" style="width: 120px;height: 22px">
		</td>
		</c:if>
	</tr>
	<tr bgcolor="#f3f3f3">
		<th width="40">번호</th>
		<th width="130">주차장 이름</th>
		<th width="100">전화번호</th>
		<th >주차장 주소</th>
		<th width="50">대수</th>
		<th width="100">단가(단위:분)</th>
		<th width="100">메모쓰기</th>
		<th width="120px">매니저임명</th>
	</tr>
	
	<c:if test="${count == 0 }">
		<td colspan="8" align="center">현재 등록된 주차장이 없습니다.<br>(주차장 등록시 사업자로 전환 됩니다.)<br>
		<a href="write.do?m_id=${m_id}"><img src="<%=request.getContextPath()%>/image/p.JPG" height="50px" width="50px"></a> 
		</td>
	</c:if>
	<c:forEach var="article" items="${list }" varStatus="status">
		<tr>   
			<td align="center">${status.index+1 }</td>
			<td><a href="detail.do?p_num=${article.p_num }">${article.p_name }</a></td>
			<td>${article.p_phone }</td>
			<td>${article.p_addr }</td>
			<td align="center">${article.p_count }</td>
			<td align="center">${article.p_cost }</td>
			<td align="center">
				<input type="button" value="메모쓰기" style="width: 120px;height: 22px;" onclick="location.href='insertMemo.do?p_num=${article.p_num}'">
			</td>
			<td align="center">
			<c:if test="${userLevel >= 3}">
				<input type="button" value="매니져 임명하기" style="width: 120px;height: 22px;" onclick="location.href='memberDetail.do?p_num=${article.p_num}'">
			</c:if>
			<c:if test="${userLevel < 3}">
				<input type="button" value="매니져 임명하기" style="width: 120px;height: 22px;background-color: gray;font-weight: bold;color: white" disabled="disabled">
			</c:if>
			</td>
		</tr>
	</c:forEach>
	<tr>
		<td align="center" colspan="8">${pagingHtml }</td>
	</tr>
</table>